package com.example.back.mapper;

import com.example.back.model.PsGame;
import com.example.back.model.SwitchGame;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface SwitchGameMapper {
    @Select("select * from switch_game order by score desc")
    List<SwitchGame> findAllSwitchGameByScore();
    @Select("select * from switch_game")
    List<SwitchGame> findAllSwitchGame();
    @Select("select * from switch_game where concat(name, introduction, yuyan, type) like concat('%', #{information}, '%')")
    List<SwitchGame> findByInformation(String information);
    @Select("select * from switch_game where instr(type, #{type})>0")
    List<SwitchGame> searchSType(String type);
    @Select("select * from switch_game where instr(name, #{name})>0")
    List<SwitchGame> selectSName(String name);
    @Insert("insert into switch_game(name, introduction, yuyan, type, score) values(#{name}, #{introduction}, #{yuyan}, #{type}, #{score})")
    Boolean insertSwitchGame(String name, String introduction, String yuyan, String type, double score);
    @Update("update switch_game set yuyan=#{yuyan} where id=#{id}")
    Boolean updateYuyanByID(int id, String yuyan);
    @Update("update switch_game set score=#{score} where id=#{id}")
    Boolean updateScoreByID(int id, double score);
    @Delete("delete from switch_game where id=#{id}")
    Boolean deleteSwitchGame(int id);
    @Select("select photo from switch_game where id=#{id}")
    String findPhotoByID(int id);
}
